package com.yixun.qfbao.model.enums;

import com.yixun.common.utils.EnumUtil;
import org.apache.commons.lang.StringUtils;

/**
 * 朝向
 */
public enum OrientationsEnum {

    NORTH("1","北"),
    SOUTH("2","南"),
    EAST("3","东"),
    WEST("4","西"),
    NORTH_SOUTH("5","南北"),
    NORTH_EAST("6","东北"),
    NORTH_WEST("7","西北"),
    WEST_SOUTH("8","西南"),
    EAST_WEST("9","东西"),
    EAST_SOUTH("10","东南");

    private final String no;
    private final String des;
    static{
        EnumUtil.ENUMS_TO_VIEW.put("check_status", CheckStatusEnum.values());
    }
    OrientationsEnum(String no, String des) {
        this.no = no;
        this.des = des;
    }
    /**
     * @return Returns the no.
     */
    public String getNo() {
        return no;
    }

    /**
     * @return Returns the des.
     */
    public String getDes() {
        return des;
    }



    /**
     * 通过枚举<code>des</code>获得枚举
     *
     * @param des
     * @return
     */
    public static OrientationsEnum getByDescription(String des) {
        if(StringUtils.isBlank(des)){
            return null;
        }
        for (OrientationsEnum menum : values()) {
            if (menum.getDes().equals(des)) {
                return menum;
            }
        }
        return null;
    }
    public static OrientationsEnum getByNo(String no) {
        if(StringUtils.isBlank(no)){
            return null;
        }
        for (OrientationsEnum menum : values()) {
            if (menum.getNo().equals(no)) {
                return menum;
            }
        }
        return null;
    }
}
